import utils.TreeNode;

import java.util.LinkedList;
import java.util.List;

/**
 * @Author ZhangCuirong
 * @Date 2025/9/8 15:40
 * @description:
 */
public class Solution145 {
    public List<Integer> postorderTraversal(TreeNode root) {
        LinkedList<Integer> res = new LinkedList<>();
        if(root == null){
            return res;
        }
        res.addAll(postorderTraversal(root.left));
        res.addAll(postorderTraversal(root.right));
        res.add(root.val);
        return res;
    }
}
